#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inl inline
#define endl '\n'
#define getchar cin.get
#define push_back emplace_back
const int N=4e5+5;
const int M=6e4+5;
const int inf=0x3f3f3f3f;
const int mod=998244853;
inl int read(){
int x=0,f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
return x*f;
}
int n,m,vis[55][55],pos1[55],pos2[55];
struct pos{
int a,b,c,d;
};
vector<pos>v,ans;
struct node{
int x,y,id;
friend bool operator<(node a,node b){return a.x^b.x?a.x<b.x:abs(a.x-a.y)<abs(b.x-b.y);}
}a[55];
inl void solvex(int x){
int xp=a[x].x,yp=a[x].y;
while(xp>x){
if(vis[xp-1][yp])solvex(vis[xp-1][yp]);
v.push_back((pos){xp,yp,xp-1,yp});
vis[xp][yp]=0;vis[--xp][yp]=x;
}
while(xp<x){
if(vis[xp+1][yp])solvex(vis[xp+1][yp]);
v.push_back((pos){xp,yp,xp+1,yp});
vis[xp][yp]=0;vis[++xp][yp]=x;
}
a[x].x=xp;
}
inl void solvey(int x){
int xp=a[x].x,yp=a[x].y;
while(yp>x){
v.push_back((pos){xp,yp,xp,yp-1});
vis[xp][yp]=0;vis[xp][--yp]=x;
}
while(yp<x){
v.push_back((pos){xp,yp,xp,yp+1});
vis[xp][yp]=0;vis[xp][++yp]=x;
}
a[x].y=yp;
}
inl void swapp(int x,int y){
if(x>y)swap(x,y);
for(int i=1;i<=y-x;i++)ans.push_back((pos){x+i-1,x,x+i,x});
for(int i=1;i<=y-x;i++)ans.push_back((pos){y-i+1,y,y-i,y});
for(int i=1;i<=y-x;i++)ans.push_back((pos){y,x+i-1,y,x+i});
for(int i=1;i<=y-x;i++)ans.push_back((pos){x,y-i+1,x,y-i});
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
n=read();m=read();
for(int i=1;i<=m;i++)a[i]={read(),read(),i};
sort(a+1,a+m+1);
for(int i=1;i<=m;i++)vis[a[i].x][a[i].y]=i;
for(int i=1;i<=m;i++)pos1[a[i].id]=i;
for(int i=1;i<=m;i++)solvex(i);
for(int i=1;i<=m;i++)solvey(i);
for(auto i:v)ans.push_back(i);
for(int i=1;i<=m;i++)vis[i][i]=0;v.clear();
for(int i=1;i<=m;i++)a[i]={read(),read(),i};
sort(a+1,a+m+1);
for(int i=1;i<=m;i++)vis[a[i].x][a[i].y]=i;
for(int i=1;i<=m;i++)pos2[a[i].id]=i;
for(int i=1;i<=m;i++)solvex(i);
for(int i=1;i<=m;i++)solvey(i);
for(int i=1;i<=m;i++)
if(pos1[i]^pos2[i]){
swapp(pos1[i],pos2[i]);
for(int j=1;j<=m;j++)
if(pos1[j]==pos2[i]){
swap(pos1[i],pos1[j]);
break;
}
}
reverse(v.begin(),v.end());
for(auto i:v)ans.push_back((pos){i.c,i.d,i.a,i.b});
cout<<ans.size()<<endl;
for(auto i:ans)cout<<i.a<<' '<<i.b<<' '<<i.c<<' '<<i.d<<endl;
return 0;
}
/*
10 10
1 1
1 3
1 5
2 2
2 4
3 1
3 3
3 5
4 2
4 4
4 5
4 3
4 1
3 4
3 2
2 5
2 3
2 1
1 4
1 2
*/
102. Binary Tree Level Order Traversal | 96. Unique Binary Search Trees |
75. Sort Colors | 74. Search a 2D Matrix |
71. Simplify Path | 62. Unique Paths |
50. Pow(x, n) | 43. Multiply Strings |
34. Find First and Last Position of Element in Sorted Array | 33. Search in Rotated Sorted Array |
17. Letter Combinations of a Phone Number | 5. Longest Palindromic Substring |
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |